package com.hdsx.restful.glzt.roadline.ljlm.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.esri.arcgis.geometry.IGeometry;
import com.hdsx.ao.base.BaseOpearte;
import com.hdsx.ao.util.GemotryUtil;
import com.hdsx.restful.glzt.roadline.ljlm.bean.Ljlm;
import com.hdsx.restful.glzt.roadline.ljlm.mapper.LjlmMapper;
import com.hdsx.restful.glzt.roadline.ljlm.service.LjlmService;

@Service
public class LjlmServiceImpl extends BaseOpearte<Ljlm> implements LjlmService {

	public LjlmServiceImpl() {
		super("GIS_LJLM");
	}

	@Resource
	private LjlmMapper ljlmMapper;
	
	@Override
	public int queryCountByParameter(String lxdm) {
		Map<String,String> map=new HashMap<String, String>();
		map.put("lxdm",lxdm);
		return ljlmMapper.queryCountByParameter(map);
	}

	@Override
	public List<Ljlm> queryByParameter(String lxdm, int begin, int end) {
		
		Map<String,Object> parameter=new HashMap<String,Object>();
		parameter.put("begin",begin);
		parameter.put("end", end);
		parameter.put("lxdm",lxdm);
		List<Ljlm> lists=ljlmMapper.queryByParameter(parameter);
		for(Ljlm ljlm:lists){
			ljlm.setShape(selectShape("ID= '"+ljlm.getId()+"'"));
		}
		return lists;
	}

	@Override
	public String queryLjlmString(String id) {
		IGeometry shape=selectShape("ID= '"+id+"'");
		return GemotryUtil.generateLineString(shape);
	}

}
